﻿@model WorkTimePrj.Models.Vac_OT

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>编辑休假加班数据</title>
     <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
	<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
     <script src="@Url.Content("~/Scripts/jquery-1.7.min.js")" type="text/javascript"></script>
     <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
     <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <style type="text/css">
        .field-validation-error{float:none;}
        .body ul.cur li{height:30px; line-height:30px;}
        .editor-label{width:90px;float:left;}
        .editor-field{float:left;}
        .Button01{font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #003677; 
height: 20px; 
border: solid 1px #5381B3; 
padding-left:4px;
padding-right:4px;
background:#ffffff  ;
}
.WP_1{margin:15px auto;width:97%;}
.WP_1 span{/*background:#FDEADA;display:block;float:left; height:30px; line-height:30px; border:solid 1px #7030A0;*text-decoration:underline;*/}
.WP_2{margin:0 auto;width:97%;}
.WP_2 ul.cur{margin:0;}
.WP_2 ul.cur li{height:30px; line-height:30px; font-family:simsun,Arial; font-size:10pt;color:#000000;}
.Sel{display:none;}
    </style>
    <script type="text/javascript">
        $(function () {
//            $('#BtnSubmit').click(function () {
//                if (valDate())
//                    return false;
//                else
//                    return true;
            //            });
//            debugger
//            var w=window.opener.href;
//            alert(window.opener.href);
            if (@ViewBag.close==1)
            {
                 window.opener.location.reload();
                window.close();
            }
            if (window.addEventListener) {
                //其它浏览器的事件代码: Mozilla, Netscape, Firefox
                //添加的事件的顺序即执行顺序 //注意用 addEventListener 添加带on的事件，不用加on 
                $('#BtnSubmit')[0].addEventListener('click', valDate, false);
            }
            else {
                //IE 的事件代码 在原先事件上添加 add 方法
                $('#BtnSubmit')[0].attachEvent('onclick', valDate);
            }
            $('#startTime').click(function () {
                WdatePicker({ dateFmt: 'yyyy-MM-dd', onpicked: valDate })
            });
            $('#endTime').click(function () {
                WdatePicker({ dateFmt: 'yyyy-MM-dd', onpicked: valDate })
            });
        });
         function valDate() {
             var date1 = new Date();
             date1.setFullYear($dp.$D('startTime').y, $dp.$D('startTime').M - 1, $dp.$D('startTime').d);
             var dayofwk1 = date1.getDay();
             var date2 = new Date();
             date2.setFullYear($dp.$D('endTime').y, $dp.$D('endTime').M - 1, $dp.$D('endTime').d);
             var dayofwk2 = date2.getDay();
             //debugger
             if (date1>date2) {
                 alert('日期错误！');
                 return false;
             }
             else {
                 return true;
             }
         }
         </script>
</head>
<body>
    @using (Html.BeginForm()) {
        @Html.ValidationSummary(true)
        <div class="WP_1">
    	 	<span>编辑休假、加班数据</span>
            </div>
        <div class="WP_2">
                @Html.HiddenFor(model => model.ID)
                @Html.HiddenFor(model => model.startDate)
                @Html.HiddenFor(model => model.endDate)
                @Html.HiddenFor(model => model.addUser)
                @Html.HiddenFor(model => model.addTime)
    			<ul  class="cur">
    			    <li>
                            <div class="editor-label">
                             @Html.LabelFor(model => model.account)
                            </div>
                            <div class="editor-field">
    	                    @Html.DropDownListFor(model=>model.account,Model.accountlist,"---")
                            @Html.ValidationMessageFor(model=>model.account)
                            </div>
    				</li>
                     <li>
                            <div class="editor-label">
                            <label>类型</label>
                            </div>
                            <div class="editor-field">
    	                    @Html.DropDownListFor(model => model.type, Model.typelist, "---")
                            @Html.ValidationMessageFor(model => model.type)
                            </div> 
    				</li>
                      <li>
                            <div class="editor-label">
                             @Html.LabelFor(model => model.hour)
                            </div>
                            <div class="editor-field">
    	                    @Html.EditorFor(model => model.hour)
                            @Html.ValidationMessageFor(model => model.hour)
                            </div>
    				</li>
                     <li>
                            <div class="editor-label">
                            <label>开始日期</label>
                            </div>
                            <div class="editor-field">
    	                    @Html.DisplayFor(model => model.startDate)
                            @Html.ValidationMessageFor(model => model.startDate)
                            </div>
    				</li>
                     <li>
                            <div class="editor-label">
                            <label>结束日期</label>
                            </div>
                            <div class="editor-field">
    	                    @Html.DisplayFor(model => model.endDate)
                            @Html.ValidationMessageFor(model => model.endDate)
                            </div>
    				</li>
                      <li>
                            <div class="editor-label">
                            <label>添加用户</label>
                            </div>
                            <div class="editor-field">
    	                    @Html.DisplayFor(model => model.addUser)
                            </div>
    				</li>
                     <li>
                            <div class="editor-label">
                            <label>添加时间</label>
                            </div>
                            <div class="editor-field">
    	                    @Html.DisplayFor(model => model.addTime)
                            </div>
    				</li>
                       <li style="padding-left:115px;height:60px;line-height:60px;">
                         <input id="BtnSubmit" type="submit" value="保存" class="Button01" />
                    </li>
                    </ul>
                    </div>
        @Html.CommonnScript()
    }
    
</body>
</html>
